use Operation;

package CheckSurvival;
@ISA=qw/Operation/;

sub init{
    my $self = shift;
    $self->dependencies(qw/EntityManager/);
}

sub perform{
    my $self = shift;

    my ($map, $pos) = ($self->params->{MAP}, $self->params->{POS});

    my $player = $self->{EntityManager}->entities->category("PLAYER")->[0];
    
    my $player_pos = $player->pos($map);
    
    if($player_pos->[0] == $pos->[0] && $player_pos->[1] == $pos->[1]){
	return ActionResult->new("DEAD", "Run into the warrior!");
    }else{
	return ActionResult->new("SUCCESS", "OK");
    }
}

1;
